package com.example.fqapp.room.database;

import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;

import com.example.fqapp.application.MyApplication;
import com.example.fqapp.room.dao.DaoUser;
import com.example.fqapp.room.entity.EntityUser;

@Database(entities = {EntityUser.class}, version = 1)
public abstract class FqDatabase extends RoomDatabase {
    public abstract DaoUser daoUser();

    // 数据库迁移（版本1到2）
    public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
        @Override
        public void migrate(@NonNull SupportSQLiteDatabase database) {
            // 添加新列user_email
            database.execSQL("ALTER TABLE `user` ADD COLUMN user_email TEXT");
        }
    };

}
